/*
 * @lc app=leetcode.cn id=11 lang=javascript
 *
 * [11] 盛最多水的容器
 */

// @lc code=start
/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function (height) {
    let max = 0
    let l = 0
    let r = height.length - 1
    while (l < r) {
        let hStart = height[l]
        let hRight = height[r]
        let temp = (hStart > hRight ? hRight : hStart) * (r - l)
        max = temp > max ? temp : max
        hStart > hRight ? r-- : l++
    }
    return max
};
// @lc code=end

